#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
	int A[101];
	int N, M;
	int a = 0;
	scanf("%d %d", &N, &M);
	for (int i = 0; i < N; i++)
	{
		scanf("%d",&A[i]);
	}
	for (int i = 0; i < M; i++)
	{
		int x = A[N - 1];
		for (int i = N - 1; i >= 0; i--)
		{
			if (i == 0)
			{
				A[0] = x;
			}
			else
			{
				A[i] = A[i - 1];
			}
		}
	}
	for (int i = 0; i < N; i++)
	{
		if (i == N - 1)
		{
			printf("%d", A[i]);
		}
		else
		{
			printf("%d ", A[i]);
		}
	}
	return 0;
}